package com.diandi.signature.manager.impl.runbatch;

import com.diandi.signature.bean.runbatch.SignatureBatchRunInfo;
import com.diandi.signature.manager.runbatch.SignatureBatchRunInfoManager;
import com.diandi.signature.mapper.SignatureBatchRunInfoMapper;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by mxp on 2017/9/18.
 */
@Component
public class SignatureBatchRunInfoManagerImpl implements SignatureBatchRunInfoManager {

    @Autowired
    private SignatureBatchRunInfoMapper signatureBatchRunInfoMapper;

    @Override
    public Integer insertSignatureBatchRunInfo(SignatureBatchRunInfo signatureBatchRunInfo) {
        if (signatureBatchRunInfo == null) {
            return 0;
        }
        return signatureBatchRunInfoMapper.insertSignatureBatchRunInfo(signatureBatchRunInfo);
    }

    @Override
    public List<SignatureBatchRunInfo> queryTask(Integer status) {
        if (status == null){
            return null;
        }
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("status", status);
        return signatureBatchRunInfoMapper.queryTask(paramMap);
    }

    @Override
    public Integer updateSignatureBatchInfo(SignatureBatchRunInfo signatureBatchRunInfo) {
        if (signatureBatchRunInfo == null){
            return 0;
        }
        return signatureBatchRunInfoMapper.updateSignatureBatchRunInfo(signatureBatchRunInfo);
    }
}
